* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 30px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out;
}

.main-menu {
    text-align: center;
}

h1 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-align: center;
    position: relative;
    animation: textGlow 2s ease-in-out infinite;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    border-radius: 3px;
}

.difficulty-select {
    margin: 30px 0;
    position: relative;
}

h2 {
    color: #34495e;
    margin-bottom: 15px;
}

select {
    padding: 12px 24px;
    font-size: 1.1em;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    width: 200px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

select:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.start-btn {
    background: linear-gradient(45deg, #3498db, #2ecc71);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.2em;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.start-btn:hover::before {
    left: 100%;
}

.rules {
    text-align: left;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rules h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.rules p {
    color: #666;
    margin: 10px 0;
    line-height: 1.5;
}

/* 游戏界面样式 */
.timer-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.timer {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 6px;
    transition: width 0.3s linear;
}

.timer.warning {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    animation: pulse 1s infinite;
}

.current-word {
    text-align: center;
    margin: 30px 0;
    animation: slideIn 0.5s ease-out;
}

.word-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.character {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.character::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    transition: 0.5s;
}

.character:hover::before {
    transform: translateX(100%);
}

.pinyin {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.hanzi {
    font-size: 2em;
    color: #2c3e50;
}

.meaning {
    color: #666;
    font-size: 1.1em;
    margin-top: 10px;
}

.input-area {
    margin: 30px 0;
}

.score {
    font-size: 1.5em;
    color: #e74c3c;
    margin-bottom: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.score.updated {
    animation: pulse 0.5s ease-out;
}

form {
    display: flex;
    gap: 10px;
    justify-content: center;
}

input[type="text"] {
    padding: 15px 25px;
    font-size: 1.1em;
    border: 2px solid transparent;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.3);
}

button {
    padding: 10px 20px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

button[type="submit"] {
    background: #2ecc71;
    color: white;
}

button[type="submit"]:hover {
    background: #27ae60;
}

.hint-btn {
    background: linear-gradient(45deg, #f1c40f, #f39c12);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1em;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hint-count {
    font-size: 1.2em;
    color: #f1c40f;
    margin-bottom: 10px;
    text-align: center;
}

.history {
    margin-top: 30px;
}

.history h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
}

.word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.used-word {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 20px;
    border-radius: 20px;
    color: #2c3e50;
    font-size: 0.9em;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.used-word:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    background: white;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .character {
        padding: 10px;
    }

    input[type="text"] {
        padding: 12px 20px;
    }

    .game-over-content {
        padding: 30px;
        margin: 20px;
    }
}

/* 添加动画效果 */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes glow {
    0% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
    50% { box-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
    100% { box-shadow: 0 0 5px rgba(52, 152, 219, 0.5); }
}

/* 应用动画效果 */
.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.character:hover {
    transform: scale(1.1);
}

.current-word {
    animation: slideIn 0.5s ease-out;
}

.score {
    transition: all 0.3s ease;
}

.score.updated {
    animation: pulse 0.5s ease-out;
}

.timer-bar {
    transition: all 0.3s ease;
}

.timer.warning {
    background: linear-gradient(90deg, #e74c3c, #c0392b);
}

.used-word {
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease-out;
}

.used-word:hover {
    transform: scale(1.05);
    background: #e8e8e8;
}

input[type="text"] {
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
    transform: scale(1.02);
}

.error-shake {
    animation: shake 0.5s ease-in-out;
}

.success-glow {
    animation: glow 1s ease-in-out;
}

/* 添加新的视觉元素 */
.difficulty-select select:hover {
    border-color: #3498db;
}

/* 游戏结束效果 */
.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
}

.game-over-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    animation: slideInUp 0.5s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 新高分效果 */
.new-high-score {
    color: #f1c40f;
    font-size: 2.5em;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    animation: textGlow 1s infinite;
    margin-bottom: 20px;
}

.final-score {
    font-size: 1.8em;
    color: #2c3e50;
    margin: 20px 0;
}

.congrats {
    color: #27ae60;
    font-size: 1.2em;
    margin-top: 10px;
}

/* 渐变背景动画 */
@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 发光文字效果 */
@keyframes textGlow {
    0% { text-shadow: 0 0 10px rgba(52, 152, 219, 0.5); }
    50% { text-shadow: 0 0 20px rgba(52, 152, 219, 0.8); }
    100% { text-shadow: 0 0 10px rgba(52, 152, 219, 0.5); }
}

/* 3D翻转效果 */
@keyframes flip {
    0% { transform: perspective(400px) rotateY(0); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

/* 添加更多动画 */
@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 游戏头部信息样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.player-score, .combo-counter, .time-display {
    text-align: center;
    padding: 10px;
}

.score-label, .combo-label, .time-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.score-value, .combo-value, .time-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c3e50;
}

.combo-counter {
    animation: pulse 0.5s ease-in-out;
}

.combo-value {
    color: #e74c3c;
}

.time-value.warning {
    color: #e74c3c;
    animation: pulse 1s infinite;
}

/* 排行榜样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.leaderboard table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.leaderboard th, .leaderboard td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

.leaderboard th {
    background: #f8f9fa;
    color: #2c3e50;
    font-weight: bold;
}

.leaderboard tr:hover {
    background: #f8f9fa;
}

/* 成就系统样式 */
.achievements-summary {
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.achievement-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.achievement {
    display: flex;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.achievement.unlocked {
    opacity: 1;
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.achievement-icon {
    font-size: 1.5em;
    margin-right: 10px;
}

.achievement-name {
    font-size: 0.9em;
}

/* 成就弹窗样式 */
.achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: slideInRight 0.5s ease-out;
    z-index: 1000;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 得分详情弹窗样式 */
.score-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    animation: fadeInScale 0.3s ease-out;
    z-index: 1000;
}

.score-detail {
    margin: 5px 0;
    font-size: 1.1em;
    color: #2c3e50;
}

.total-score {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 1.3em;
    font-weight: bold;
    color: #e74c3c;
}

@keyframes fadeInScale {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* 玩家信息样式 */
.player-info {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.change-name-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.change-name-btn:hover {
    background: #2980b9;
}

/* 排行榜按钮样式 */
.leaderboard-btn {
    background: linear-gradient(45deg, #9b59b6, #8e44ad);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1em;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 10px;
}

.leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #666;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: #e74c3c;
    transform: scale(1.1);
}

/* 游戏结束统计信息样式 */
.game-over-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
}

/* 游戏结束按钮样式 */
.game-over-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.restart-btn, .menu-btn {
    padding: 12px 24px;
    font-size: 1.1em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.restart-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
}

.menu-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
}

.restart-btn:hover, .menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-icon {
    font-size: 1.2em;
}

/* 按钮点击效果 */
.restart-btn:active, .menu-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* 游戏结束内容动画优化 */
.game-over-content {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式调整 */
@media (max-width: 600px) {
    .game-over-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .game-over-stats {
        flex-direction: column;
        gap: 15px;
    }
} 